import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import Icons from 'unplugin-icons/vite' //图标
import IconsResolver from 'unplugin-icons/resolver'
import path from 'path' //导入 node.js path

export default defineConfig({
  plugins: [vue(),
  AutoImport({
    resolvers: [ElementPlusResolver(),
    IconsResolver()
    ],
  }),
  Components({
    resolvers: [ElementPlusResolver(),
    IconsResolver({
      enabledCollections: ['ep'],
    })
    ],
  }),
  Icons({
    autoInstall: true,
  }),
  ],
  resolve: {
    alias: { //配置路径别名
      '@': path.resolve(__dirname, 'src')
    }
  },
  server: {
    port: 7070,
    open: true //自动打开浏览器
  }
})
